import requests
from lxml import etree
headers = {
    'User-Agent':"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36"
}

def test_quoat():
    url = "https://www.geyanw.com/"
    response = requests.get(url=url,headers=headers)
    html_doc = response.text
    html_tree = etree.HTML(html_doc)
    quoat_list = html_tree.xpath('//div[@class="listbox"]/dl')
    for quoat in quoat_list:
        quoat_category_list = quoat.xpath('./dt/strong/a/text()')
        print(quoat_category_list)
        # quoat_menu_list = quoat.xpath('./dd/ul/li/a/text()')
        # print(quoat_menu_list)
        quoat_menuhref_list = quoat.xpath('./dd/ul/li/a/@href')
        for menuhref in quoat_menuhref_list:
            menuhref_url = "https://www.geyanw.com" + menuhref
            print( menuhref_url)
            response_again = requests.get(url=menuhref_url,headers=headers)
            html_doc_again = response_again.text
            html_tree_again = etree.HTML(html_doc_again)
            quoat_detial_list = html_tree_again.xpath('//div[@class="content"]/p[position()<3]/text()')
            print(quoat_detial_list)



test_quoat()